LDFLAGS  += -lpthread

# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

# kernel

ARCHINCLUDE    := arch/um/include   \
                  arch/um/drivers

ARCHSRCDIR     := arch/um/kernel    

ARCHDRIVERDIR  := arch/um/drivers

ARCHINCLUDE	   := $(foreach dir,$(ARCHINCLUDE),$(addprefix -I,$(dir)))
ARCHCFLAGS	   := $(ARCHINCLUDE)

$(call add_files_cc,$(call listf_cc,$(ARCHSRCDIR)),arch_kernel,$(ARCHCFLAGS))

# ignore -Iinclude/. Is there any better methods?
TMP := $(CFLAGS)
CFLAGS := -Wall -ggdb
$(call add_files_cc,$(call listf_cc,$(ARCHDRIVERDIR)),arch_driver,)
CFLAGS := $(TMP)

ARCHOBJS	= $(call read_packet,arch_kernel arch_driver)

# create kernel target
kernel = $(call totarget,kernel)

$(kernel): $(ARCHOBJS) $(OBJS)
	$(V)echo + ld $@
	$(V)$(CC) -o $@ $(ARCHOBJS) $(OBJS) $(LDFLAGS)

$(call create_target,kernel)

# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

$(call finish_all)
